function SrvOauth(params){ 
	 
}

SrvOauth.Where = function(type,proxy){
	this.type = type;
	this.proxy=proxy;
	this.linked = null;
	this.set = null;
	if(this.type==0){
		this.set = new SrvOauth.Where(1,true);
		this.set.linked = this;
	}
	this.getProxy = function(){
		var m = new SrvOauth.Where(this.type);//当前的对像
		if(this.type==0){
			m.set = new SrvOauth.Where(1,true);//set对象
			m.set.linked = m;
		}else{
			m.linked=this.linked;
			this.linked.linked=m;
		}
		return m;
	}
	this.data = {};
	this.put = function(key,value){
		this.data[key] = value;
	}
	this.get = function(key){
		return this.data[key];
	}
	
	
	/** 编号 [非空]       **/
	this.soId=function(soId){if(this.proxy)return this.getProxy().soId(soId);  this.put("soId", soId);return this;};
	/** and so_id is null */
	this.soIdNull=function(){if(this.proxy)return this.getProxy().soIdNull();if(this.get("soIdNot")==null)this.put("soIdNot", "");this.put("soId", null);return this;};
	/** not .... */
	this.soIdNot=function(){if(this.proxy)return this.getProxy().soIdNot();this.put("soIdNot", "not");return this;};
	this.soIdNotNull=function(){if(this.proxy)return this.getProxy().soIdNotNull();this.put("soIdNot", "not");this.put("soId", null);return this;};
	this.soIdNot=function(soId){if(this.proxy)return this.getProxy().soIdNot(soId);this.put("soIdNot", "not");this.put("soId", soId);return this;};
		
	/** and so_id <= ? */
	this.soIdMin=function(min){if(this.proxy)return this.getProxy().soIdMin(min);this.put("soIdMin", min);return this;};
	/** and so_id >= ? */
	this.soIdMax=function(max){if(this.proxy)return this.getProxy().soIdMax(max);this.put("soIdMax", max);return this;};
		
		
	this.soIdIn=function(ids){
		if(this.proxy)return this.getProxy().soIdIn(ids);  this.put("soIdIn", ids);return this;
	};	
		 
	
	
	/** Token [非空]       **/
	this.soToken=function(soToken){if(this.proxy)return this.getProxy().soToken(soToken);  this.put("soToken", soToken);return this;};
	/** and so_token is null */
	this.soTokenNull=function(){if(this.proxy)return this.getProxy().soTokenNull();if(this.get("soTokenNot")==null)this.put("soTokenNot", "");this.put("soToken", null);return this;};
	/** not .... */
	this.soTokenNot=function(){if(this.proxy)return this.getProxy().soTokenNot();this.put("soTokenNot", "not");return this;};
	this.soTokenNotNull=function(){if(this.proxy)return this.getProxy().soTokenNotNull();this.put("soTokenNot", "not");this.put("soToken", null);return this;};
	this.soTokenNot=function(soToken){if(this.proxy)return this.getProxy().soTokenNot(soToken);this.put("soTokenNot", "not");this.put("soToken", soToken);return this;};
		
		 
	
	
	/** 帐号ID [非空]       **/
	this.soUserId=function(soUserId){if(this.proxy)return this.getProxy().soUserId(soUserId);  this.put("soUserId", soUserId);return this;};
	/** and so_user_id is null */
	this.soUserIdNull=function(){if(this.proxy)return this.getProxy().soUserIdNull();if(this.get("soUserIdNot")==null)this.put("soUserIdNot", "");this.put("soUserId", null);return this;};
	/** not .... */
	this.soUserIdNot=function(){if(this.proxy)return this.getProxy().soUserIdNot();this.put("soUserIdNot", "not");return this;};
	this.soUserIdNotNull=function(){if(this.proxy)return this.getProxy().soUserIdNotNull();this.put("soUserIdNot", "not");this.put("soUserId", null);return this;};
	this.soUserIdNot=function(soUserId){if(this.proxy)return this.getProxy().soUserIdNot(soUserId);this.put("soUserIdNot", "not");this.put("soUserId", soUserId);return this;};
		
	/** and so_user_id <= ? */
	this.soUserIdMin=function(min){if(this.proxy)return this.getProxy().soUserIdMin(min);this.put("soUserIdMin", min);return this;};
	/** and so_user_id >= ? */
	this.soUserIdMax=function(max){if(this.proxy)return this.getProxy().soUserIdMax(max);this.put("soUserIdMax", max);return this;};
		
		
	this.soUserIdIn=function(ids){
		if(this.proxy)return this.getProxy().soUserIdIn(ids);  this.put("soUserIdIn", ids);return this;
	};	
		 
	
	
	/** API客户端 [非空] [SrvApiClient]      **/
	this.soApiClient=function(soApiClient){if(this.proxy)return this.getProxy().soApiClient(soApiClient);  this.put("soApiClient", soApiClient);return this;};
	/** and so_api_client is null */
	this.soApiClientNull=function(){if(this.proxy)return this.getProxy().soApiClientNull();if(this.get("soApiClientNot")==null)this.put("soApiClientNot", "");this.put("soApiClient", null);return this;};
	/** not .... */
	this.soApiClientNot=function(){if(this.proxy)return this.getProxy().soApiClientNot();this.put("soApiClientNot", "not");return this;};
	this.soApiClientNotNull=function(){if(this.proxy)return this.getProxy().soApiClientNotNull();this.put("soApiClientNot", "not");this.put("soApiClient", null);return this;};
	this.soApiClientNot=function(soApiClient){if(this.proxy)return this.getProxy().soApiClientNot(soApiClient);this.put("soApiClientNot", "not");this.put("soApiClient", soApiClient);return this;};
		
		
	this.soApiClientIn=function(ids){
		if(this.proxy)return this.getProxy().soApiClientIn(ids);  this.put("soApiClientIn", ids);return this;
	};	
		 
	
	
	/** 三方标识        **/
	this.soTicket=function(soTicket){if(this.proxy)return this.getProxy().soTicket(soTicket);  this.put("soTicket", soTicket);return this;};
	/** and so_ticket is null */
	this.soTicketNull=function(){if(this.proxy)return this.getProxy().soTicketNull();if(this.get("soTicketNot")==null)this.put("soTicketNot", "");this.put("soTicket", null);return this;};
	/** not .... */
	this.soTicketNot=function(){if(this.proxy)return this.getProxy().soTicketNot();this.put("soTicketNot", "not");return this;};
	this.soTicketNotNull=function(){if(this.proxy)return this.getProxy().soTicketNotNull();this.put("soTicketNot", "not");this.put("soTicket", null);return this;};
	this.soTicketNot=function(soTicket){if(this.proxy)return this.getProxy().soTicketNot(soTicket);this.put("soTicketNot", "not");this.put("soTicket", soTicket);return this;};
		
		 
	
	
	/** 三方参数        **/
	this.soParams=function(soParams){if(this.proxy)return this.getProxy().soParams(soParams);  this.put("soParams", soParams);return this;};
	/** and so_params is null */
	this.soParamsNull=function(){if(this.proxy)return this.getProxy().soParamsNull();if(this.get("soParamsNot")==null)this.put("soParamsNot", "");this.put("soParams", null);return this;};
	/** not .... */
	this.soParamsNot=function(){if(this.proxy)return this.getProxy().soParamsNot();this.put("soParamsNot", "not");return this;};
	this.soParamsNotNull=function(){if(this.proxy)return this.getProxy().soParamsNotNull();this.put("soParamsNot", "not");this.put("soParams", null);return this;};
	this.soParamsNot=function(soParams){if(this.proxy)return this.getProxy().soParamsNot(soParams);this.put("soParamsNot", "not");this.put("soParams", soParams);return this;};
		
		 
	
	
	/** 登录时间 [非空]       **/
	this.soUpdateTime=function(soUpdateTime){if(this.proxy)return this.getProxy().soUpdateTime(soUpdateTime);  this.put("soUpdateTime", soUpdateTime);return this;};
	/** and so_update_time is null */
	this.soUpdateTimeNull=function(){if(this.proxy)return this.getProxy().soUpdateTimeNull();if(this.get("soUpdateTimeNot")==null)this.put("soUpdateTimeNot", "");this.put("soUpdateTime", null);return this;};
	/** not .... */
	this.soUpdateTimeNot=function(){if(this.proxy)return this.getProxy().soUpdateTimeNot();this.put("soUpdateTimeNot", "not");return this;};
	this.soUpdateTimeNotNull=function(){if(this.proxy)return this.getProxy().soUpdateTimeNotNull();this.put("soUpdateTimeNot", "not");this.put("soUpdateTime", null);return this;};
	this.soUpdateTimeNot=function(soUpdateTime){if(this.proxy)return this.getProxy().soUpdateTimeNot(soUpdateTime);this.put("soUpdateTimeNot", "not");this.put("soUpdateTime", soUpdateTime);return this;};
		
	/** and so_update_time >= ? */
	this.soUpdateTimeStart=function(start){if(this.proxy)return this.getProxy().soUpdateTimeStart(start);this.put("soUpdateTimeStart", start);return this;};			
	/** and so_update_time <= ? */
	this.soUpdateTimeEnd=function(end){if(this.proxy)return this.getProxy().soUpdateTimeEnd(end);this.put("soUpdateTimeEnd", end);return this;};
		
		 
	
	
	
	this.add=function(key,value) {if(proxy)return proxy().add(key,value);this.put(key, value);return this;}
	this.desc=function(sql) {if(proxy)return proxy().desc(sql);this.put("desc", sql);return this;}
	this.asc=function(sql) {if(proxy)return proxy().asc(sql);this.put("asc", sql);return this;}
	this.definex=function(sql) {if(proxy)return proxy().definex(sql);this.put("definex", sql);return this;}
	
	/** 获取所有用户授权 **/
	this.list=function(size){
		this.data.size = size;
		var protocol = ux.ajax("/admin/api/oauth.list.do",this.data);
		if(!protocol)return null;
		if(protocol.data && protocol.data.list)return protocol.data.list;
		return [];
	}
	/** 获取用户授权分页 **/
	this.page=function(page,size){
		this.data.size = size;
		this.data.page = page;
		var protocol = ux.ajax("/admin/api/oauth.list.do",this.data);
		if(!protocol)return null;
		if(protocol.data)return data;
		return {list:[]};
	}
	/** 根据查询条件取用户授权 **/
	this.get=function(){
		this.data.size = 1;
		var protocol = ux.ajax("/admin/api/oauth.list.do",this.data);
		if(!protocol)return null;
		if(protocol.data && protocol.data.list && protocol.data.list.length==1)return protocol.data.list[0]; 
		return null;
	}
}

SrvOauth.get = function(id){
	var protocol = ux.ajax("/admin/api/oauth.get.do",{id:id});
	if(!protocol)return null;
	if(protocol.data)return protocol.data.srvOauth;
	return null;
}

SrvOauth.where = new SrvOauth.Where(0,true);